package com.haidong.string;

import java.util.Scanner;

public class StringEquals {
    public static void main(String[] args) {
        String name = "这是账号";
        String password = "123456";
        Scanner sc = new Scanner(System.in);
        System.out.println("please input your id:");
        String inputName = sc.next();
        System.out.println("please input your password:");
        String inputPassword = sc.next();
        //String对象比较必须用equals方法,直接比较对象名的话,逻辑上是比较地址会出错误
        if(password.equals(inputPassword) && name.equals(inputName)){
            System.out.println("link start");
        }
        //equals方法还有类似的ignorecase,忽略大小写比较字符串内容
        String str1 = "A1B2C3";
        String str2 = "a1b2c3";
        if(str1.equalsIgnoreCase(str2)){
            System.out.println("is right");
        }
    }
}
